# -*- coding: utf-8 -*-

"""
Created on Wed Nov 18 10:18:35 2020
Pytest
pip install pytest
pip list
pytest --version
pytest --help
anaconda
# 在 Ipython console 运行
run -m pytest 213_Software_Testing_12_PytestforPython_an_introduction.py
# 在 CMD运行
pytest 213_Software_Testing_12_PytestforPython_an_introduction.py
run -m pytest -k add 213_Software_Testing_12_PytestforPython_an_introduction.py -v
pytest --durations=0 -vv 213_Software_Testing_12_PytestforPython_an_introduction.py
pytest --durations=1 -vv 213_Software_Testing_12_PytestforPython_an_introduction.py
pytest --durations=10 -vv 213_Software_Testing_12_PytestforPython_an_introduction.py
运行 anaconda prompt --》d:-- 》 cd D:\python\videos\Assignments\PandasVideos --》pytest -k add 213_Software_Testing_12_PytestforPython_an_introduction.py -v
@author: andrew
"""

import pytest


def add(a, b):
    return a + b


def minus(a, b):
    return a - b


def multi(a, b):
    return a * b


def divide(a, b):
    return a / b


def isEven(a):
    if a % 2 == 0:
        return True
    else:
        return False


def funcerror(a):
    if a == 0:
        raise ValueError('Error Error')
    else:
        pass


def test_add():
    assert 3 == add(1, 2)


def test_addfailure():
    assert 3.1 == add(1, 2)


def test_minus():
    assert -1 == minus(1, 2)


def test_funcerror1():
    with pytest.raises(ValueError):
        funcerror(0)


def test_funcerror2():
    funcerror(1) == None
